#ifndef _SOCKETSERVER_H_
#define _SOCKETSERVER_H_

#include "Socket.h"
#include "SocketClient.h"

/*
 * Server class
 */
class SocketServer : public Socket
{
    public:
        SocketServer(void);
        SocketServer(int tcpPort, int connections);
        ~SocketServer();
        int readSockets();
        bool readable(Socket const * const s);
        void receiveError(int, Socket *);
        void sendError(int r, Socket *client);
        std::vector<Socket *> clients;
        Socket tcpListen;
        sockaddr_in tcpaddr;

    private:
        int acceptConn(Socket *);
        void deleteClient(int id);
        int tcpListenPort;
        unsigned int highSock;
        int maxConnections;
        int clientIdCount;
        fd_set readfds;
        bool full;
};

#endif
